Repository navigation
Require every "check to submit" checkbox before enabling submit - #104
Merged
Merged
Conversation
The click handler only looked at the checkbox that was clicked, so with two or more required checkboxes, checking any one enabled the submit button. Evaluate all required checkboxes together, and wait for the anti-bot countdown to finish before enabling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GjYTexmHbnYghvDQuLhfLW
… works Composer 2.10 now fails 'composer install' when composer.lock predates allow-plugins and composer.json doesn't declare it. Declare the plugin and refresh the lock hash (package versions unchanged). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GjYTexmHbnYghvDQuLhfLW
Member
Author
|
CI note: both PHP jobs on c9b6b6f failed at This isn't caused by this PR's change, which only touches The fix is in #105. I've ported the same commit here as 2ea9337 so this PR can go green. Once #105 merges, that commit will have nothing left to change here. Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reported on the forum:
https://community.disciple.tools/topic/183/multiple-check-to-submit-checkboxes-the-form-can-be-submitted-when-only-one-is-checkedProblem
When a form has two or more checkbox fields set to "Require checkbox checked", checking any one of them enables the submit button. Someone can submit without checking all of the required boxes, which matters for consent checkboxes (GDPR, age, etc.).
Cause
In
public/public.jsthe click handler on.input-checkboxset the button's disabled state from only the checkbox that was clicked:prop('disabled', !jQuery(this).prop('checked')). It never looked at the other required checkboxes.There was also a smaller timing issue:
enforce_requires_check_to_submit()disabled the button whenever any required checkbox existed, whether or not it was checked. If a user checked the box during the 5-second anti-bot countdown, the button stayed disabled once the countdown finished until they unchecked and re-checked it. Checking a box during the countdown could also enable the button early.Fix
enforce_requires_check_to_submit()now checks everycheck_to_submitcheckbox and enables the button only when all of them are checked.changeand calls the same function.Forms with no required checkboxes behave as before: submit is enabled when the countdown ends.
Testing
I tested in headless Chromium with a page that had two required checkboxes and one optional checkbox:
Note: the submit button is still only a client-side check. Nothing on the server validates required checkboxes. That is unchanged by this PR.
🤖 Generated with Claude Code
https://claude.ai/code/session_01GjYTexmHbnYghvDQuLhfLW
Generated by Claude Code